import { Exclude } from 'class-transformer'
import {
  Column,
  Entity,
  JoinTable,
  ManyToMany,
  OneToMany,
  Relation,
} from 'typeorm'

import { SoftCommonEntity } from '~/common/entity/common.entity'
import { CUserStatus, CGuardianRelation } from '../constant'

@Entity({ name: 'c_user' })
export class CUserEntity extends SoftCommonEntity {
  @Column({ name: 'user_id' })
  userId: string

  @Column({ unique: true })
  phone: string

  @Column({ name: 'user_name' })
  userName: string

  @Column({ name: 'guarder', comment: '监护人' })
  guarder: string

  @Column({ name: 'guarder_phone', comment: '监护人电话' })
  guarderPhone: string

  @Column({ name: 'guarder_relation', type: 'int', comment: '与监护人关系，0 未知 1 爸爸 2 妈妈 3 爷爷 4 奶奶 5 外公 6 外婆', default: CGuardianRelation.Unknown })
  guarderRelation: CGuardianRelation

  @Column({ name: 'birthday', type: 'datetime', nullable: true, comment: '出生日期' })
  birthday: Date

  @Column({ comment: '学校' })
  school: string

  @Column({ name: 'province', comment: '省份' })
  province: string

  @Column({ name: 'city', comment: '城市' })
  city: string

  @Column({ comment: '学级，0 幼儿园，1-6 小学，7-8 初中', default: 0 })
  grade: number

  @Column({ name: 'from', comment: '来源，1 转介绍 2 小红书 3 抖音', default: 1 })
  from: number

  @Column({ comment: '用户阶段，1 线索 2 机会用户 3 已付费未激活 4 付费一年 5 一年未续费', default: 1 })
  status: CUserStatus

  @Column({ comment: '备注' })
  mark: string

  @Column({ name: 'create_by', comment: '创建者' })
  createBy: number

  @Column({ name: 'update_by', comment: '更新者' })
  updateBy: number
}
